#include<bits/stdc++.h>
using namespace std;
struct group{
    int n;
    int a[1000];
}g[1000];
int main(){
    freopen("color.in","r",stdin);
    freopen("color.out","w",stdout);
    int t;
    cin>>t;
    for(int i=1;i<=t;i++){
        cin>>g[i].n>>g[i].a[1000];
    }
    for(int i=1;i<=t;i++){
        cout<<g[i].n<<" "<<g[i].a[1000]<<endl;
    }
    return 0;
}